package com.bawei.arouter

import android.content.Context
import android.util.Log
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.DegradeService
import com.alibaba.android.arouter.launcher.ARouter

/**
 * 全局的降级策略，作用整个应用
 */
@Route(path = "/degrade/custom")
class CustomDegradeService: DegradeService {
    private var mContext: Context? = null
    override fun init(context: Context?) {
        mContext = context
    }

    override fun onLost(context: Context?, postcard: Postcard?) {
        Log.e("CustomNavigation", "onLost:Target Page not found： " + postcard?.path)
        ARouter.getInstance().build("/empty/activity").navigation()
    }
}